<div class="pageContent">
    <form method="post" id="updateWorkCenterFrom" action="${rc.getContextPath()}/manage/workCenter/modifyWorkCenter" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone)">
        <input type="hidden" name="parentWorkCenterCode" value="<#if (workCenter)??>${workCenter.parentWorkCenterCode!''}</#if>" />
        <input type="hidden" name="navTabId" value="${navTabId!''}" />
        <div class="pageFormContent nowrap">
            <fieldset>
                <dl>
                    <dt><@label key="workCenter_type.C,colon">工作中心类型：</@label></dt>
                    <dd>
                        <select name="workCenterTypeCode" class="required" disabled="disabled">                
                            <option value=""><@label key='selected_first.C'>请选择</@label></option>
                            <#if workTypes??>
                                <#list workTypes as workCenterType>
                                    <option value="${workCenterType.workCenterTypeCode!''}" 
                                    <#if workCenter?? && workCenter.workCenterTypeCode==workCenterType.workCenterTypeCode>selected</#if> >${workCenterType.typeText!''}</option>
                                </#list>
                            </#if>
                        </select>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="code.C,colon">编号：</@label></dt>
                    <dd>
                        <input readonly="readonly" name="workCenterCode"  value="${workCenter.workCenterCode!''}" size="32" type="text" maxlength="20" class="required" />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="description.C,colon">描述：</@label></dt>
                    <dd>
                        <input readonly="readonly" name="workCenterText" value="<#if (workCenter.workCenterText)??>${workCenter.workCenterText!''}</#if>" size="32" maxlength="60" type="text" />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="workCalendar.C,colon">工作日历：</@label></dt>
                    <dd>
                        <select name="calendarCode" disabled="disabled">                
                            <option value=""><@label key='selected_first.C'>请选择</@label></option>
                            <#if calendars??>
                                <#list calendars as calendar>
                                    <option value="${calendar.calendarCode!''}"
                                    <#if workCenter?? && workCenter.calendarCode==calendar.calendarCode>selected</#if> >${calendar.calendarText!''}</option>
                                </#list>
                            </#if>
                        </select>
                    </dd>
                </dl>
                
                <dl>
					<dt><@label key="defaultWarehouse.C,colon">默认线边仓库：</@label></dt>
						<dd>				  
						<select  id="mm_warehouseCode" class="allyselect required valid" ref="storageLocation" postField="warehouseCode"  name="warehouseCode" refUrl="${rc.getContextPath()}/manage/warehouse/warehouseChange"
						   disabled="disabled" default="${workCenter.warehouseCode!''}">	
						    		
						</select>
					   		</dd>			
					
				</dl>
				<dl>
					<label><@label key="defaultStorageLocation.C,colon">默认线边库位：</@label></label>	
					<dd>
						<select selectedValue="${workCenter.storageLocationCode!''}" id="storageLocation" field="storageLocationCode" name="storageLocationCode" label="storageLocationText" disabled="disabled" >
						</select>
						</dd>
						
					</dl>  
                <dl>
                    <dt>&nbsp;</dt>
                    <dd>
                        <label><input  disabled="disabled" style="margin-right: 2px;" type="checkbox" name="lockFlag" value="1"<#if (workCenter.lockFlag)?? && (workCenter.lockFlag == 1)> checked="true"</#if>><@label key="lock.C">锁定</@label></label>
                    </dd>
                </dl>
                <dl>
                    <dt>&nbsp;</dt>
                    <dd id="workCenter_button">
                        
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit" onclick="_editWorkCenter()"><@label key="edit.B">编辑</@label></button>
                            </div>
                        </div>
                        
                    </dd>
                </dl>
            </fieldset>
        </div>
        <#if workCenter??> <#assign createInfo=workCenter/> 
                        <#include "/common/createInfo.html"> </#if>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        var _workCenterEdit = "<@buttonRight menuCode='workCode_edit' labelKey='edit.B' defalutName='编辑'></@buttonRight>";
        if(_workCenterEdit && _workCenterEdit!=''){
            $("#workCenter_button").html("<div class='buttonDisabled'><div class='buttonContent'><button type='button'><@label key='edit.B'>编辑 </@label></button></div></div>");
        }else{
            $("#workCenter_button").html("<div class='buttonActive'><div class='buttonContent'><button onclick='_editWorkCenter()' type='button'><@label key='edit.B'>编辑</@label></button></div></div>");
        }
    })
    function _editWorkCenter() {
        $("#updateWorkCenterFrom", navTab.getCurrentPanel()).find("[readonly='readonly'],[disabled='disabled']").each(function(){
            if($(this).attr("name")!='workCenterCode' && $(this).attr("name")!='workCenterTypeCode'){
                $(this).removeAttr("readonly");
                $(this).removeAttr("disabled");
                $(this).removeClass("readonly");
            }
        });
        $("#workCenter_button").html("<div class='buttonActive'><div class='buttonContent'><button type='submit'><@label key='save.B'>保存 </@label></button></div></div>");
    }
    
    function getWarehouse(){
    	var $select = $("select#mm_warehouseCode", navTab.getCurrentPanel());
    	$.DWZajax({
            url:hostUrl +"/warehouse/selectWarehouse",
            
            callback:function(data){
                if(data && data.length > 0){
                	
                   var warehouseCode = $select.attr("default");
                   
                    var options = "";  
                    for(var i=0; i<data.length; i++){    
                    	if(warehouseCode==data[i].warehouseCode){
                            options += "<option selected='selected' value="+data[i].warehouseCode+">"+data[i].warehouseText+"</option>";

                    	}else{
                            options += "<option value="+data[i].warehouseCode+">"+data[i].warehouseText+"</option>";
                    	}
                            
                    }
                    $select.html(options);
                    
                }else{
                	$select.html("");
                }
                $select.change();
            }
        });
    }
    $(function(){
    	　　getWarehouse();
    	}); 
</script>